package com.example.imtoken.modules.main.wallet.collection

import androidx.lifecycle.MutableLiveData
import com.example.imtoken.core.base.BaseViewModel
import com.example.imtoken.core.datas.DataUtils
import com.example.imtoken.entitys.app.WalletsEntity
import java.util.*

class CollectionViewModel : BaseViewModel() {

    private val collectionLiveData: MutableLiveData<MutableList<WalletsEntity>> =
        MutableLiveData(ArrayList())

    var data: MutableList<WalletsEntity> = ArrayList()

    fun getCollectionLiveData(): MutableLiveData<MutableList<WalletsEntity>> {
        return collectionLiveData
    }

    fun getData() {
        data = DataUtils.getWalletList()
        collectionLiveData.value = data
    }

    fun getPageData() {
        val start = collectionLiveData.value?.size ?: 0
        val end = collectionLiveData.value?.size?.plus(10) ?: 10
        data.addAll(DataUtils.getWalletList(start, end))
        collectionLiveData.value = data
    }

}